package com.wva.user.domain.dto;

import com.wva.common.constant.PatternConst;
import com.wva.common.domain.Payloads;
import com.wva.common.domain.dto.PictureCaptchaVerifyDTO;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
public class LoginDTO {
    @NotEmpty(message = "请输入手机号")
    @Pattern(regexp = PatternConst.PHONE, message = "手机号格式错误")
    private String phone;

    @NotEmpty(message = "请输入密码", groups = Pass.class)
    private String password;

    @NotEmpty(message = "验证码不能为空", groups = Sms.class)
    private String code;

    /**
     * 图形验证码，需在代码里判空
     */
    @NotNull(payload = Payloads.RequirePictureCaptcha.class, groups = Captcha.class)
    private PictureCaptchaVerifyDTO pictureVerify;

    //分组
    public interface Pass {}
    public interface Sms {}
    public interface Captcha { }
}
